goog.provide('czk.ui.grid.Grid');

goog.require('goog.dom');
goog.require('goog.dom.TagName');

goog.require('czk.ui.ZKComponent');

/**
 * @constructor
 * @extends {czk.ui.ZKComponent}
 */
czk.ui.grid.Grid = function() {
  goog.base(this);
};
goog.inherits(czk.ui.grid.Grid, czk.ui.ZKComponent);

czk.ui.grid.Grid.prototype.table = null;

czk.ui.grid.Grid.prototype.createDom = function() {
  var dh = this.getDomHelper();
  var el = dh.createDom(goog.dom.TagName.DIV, {
    'className': 'inf_table linedTable'
  });

  this.table = dh.createDom(goog.dom.TagName.TABLE, {
    'className': 'linedTable'
  });
  goog.dom.insertChildAt(el, this.table);

  var el1 = dh.createDom(goog.dom.TagName.DIV, {
    'className': 'tableAfter'
  });
  goog.dom.insertChildAt(el, el1);

  this.setElementInternal(el);
};

czk.ui.grid.Grid.prototype.getContentElement = function() {
  return this.table;
};

czk.ui.grid.Grid.prototype.handleZKResponseCommand = function(command) {
  // general handling
  if (command[0] == 'outer') {
    var parent = this.getParent();
    parent.removeChild(this, true);
    goog.array.forEach(command[1][1], parent.addZKChild, parent);

  }
};

czk.ui.grid.Grid.create = function() {
  return new czk.ui.grid.Grid();

};
